Skip to content

feat(spanner): Cleanup GcpFallbackChannel creation and enable by default#12707

Open
kinsaurralde wants to merge 5 commits intogoogleapis:mainfrom
kinsaurralde:eef
Open

feat(spanner): Cleanup GcpFallbackChannel creation and enable by default#12707
kinsaurralde wants to merge 5 commits intogoogleapis:mainfrom
kinsaurralde:eef

Conversation

@kinsaurralde
Copy link
Copy Markdown
Contributor

  • Clean up setupGcpFallback by using new getDecoratedChannelBuilder instead of capturing cloudpath ChannelConfigurator
  • Set EEF period to 3 minutes
  • Enable fallback by default (still only used when direct access is enabled)

@kinsaurralde kinsaurralde requested review from a team as code owners April 7, 2026 22:50
@kinsaurralde kinsaurralde changed the title Cleanup GcpFallbackChannel creation and enable by default feat(spanner): Cleanup GcpFallbackChannel creation and enable by default Apr 7, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enables GCP fallback by default in SpannerOptions and refactors GapicSpannerRpc to simplify fallback channel setup using createDecoratedChannelBuilder. It also introduces a 3-minute period for fallback options. Feedback identifies a missing import for java.time.Duration and notes that the 10ms sleep in the integration tests is now insufficient to trigger the fallback check due to the increased period.

@@ -229,7 +229,6 @@
import java.util.concurrent.Future;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The Duration class is used in this file (e.g., at line 566) but it is not imported. Please add the missing import for java.time.Duration.

Suggested change
import java.util.concurrent.Future;
import java.time.Duration;
import java.util.concurrent.Future;

assertEquals(ErrorCode.UNAVAILABLE, exception.getErrorCode());

// Wait briefly for the 10ms period to trigger the fallback check
Thread.sleep(10);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The test waits for 10ms, but the production code now sets the fallback period to 3 minutes (Duration.ofMinutes(3)). This will likely cause the test to fail as the fallback check won't trigger within the sleep duration. Consider overriding the period in the test to a smaller value or adjusting the test expectations. Additionally, please remove the stale code comment '10ms period' instead of updating it, as it no longer reflects the implementation.

References
  1. Remove comments that refer to stale implementations instead of updating them.

assertEquals(ErrorCode.UNAVAILABLE, exception.getErrorCode());

// Wait briefly for the 10ms period to trigger the fallback check
Thread.sleep(10);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Similar to the previous test case, the 10ms sleep is likely insufficient given the new 3-minute fallback period set in GapicSpannerRpc. The test should be updated to ensure the fallback check is triggered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant